﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ReadeAssetManager
{
    public partial class ucAssets : UserControl
    {
        AMSServiceRef.User _user;
        delegateReturnObject _returnobj;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="CurrentUser">[AMSServiceRef.User] The current application user.</param>
        /// <param name="ReturnObjMethod">[delegateReturnObject] The delegate method from the
        /// frmMain userform.  This delegate is simply passed on to the the ucAssetsTree 
        /// usercontrol</param>
        public ucAssets(AMSServiceRef.User CurrentUser, delegateReturnObject ReturnObjMethod)
        {
            InitializeComponent();
            _user = CurrentUser;
            _returnobj = ReturnObjMethod;
            LoadTreeView();
        }

        /// <summary>
        /// LoadTreeView
        /// Instantiates a ucAssetsTree control to display the user's assets.
        /// </summary>
        private void LoadTreeView()
        {
            pnlAssets.Controls.Clear();
            ucAssetsTree at = new ucAssetsTree(_user, _returnobj);
            pnlAssets.Controls.Add(at);
            at.Dock = DockStyle.Fill;
        }
    }
}
